<template>
  <div>
    <van-nav-bar
      title="收藏房源"
      left-text="返回"
      left-arrow
      @click-left="$router.back()"
    />
    <van-list>
      <houses-item
        v-for="(item, index) in favoritesList"
        :key="index"
        :houseInfo="item"
      ></houses-item>
    </van-list>
  </div>
</template>
<script>
import { favoritesListApi } from "@/api";
import HousesItem from "@/components/HousesItem.vue";
export default {
  name: "",
  data() {
    return {
      favoritesList: [],
    };
  },
  components: { HousesItem },
  computed: {},
  methods: {},
  async created() {
    try {
      const res = await favoritesListApi();
      console.log(res);
      this.favoritesList = res.data.body;
      this.$toast({
        message: res.data.description,
        icon: "like-o",
      });
    } catch (error) {
      this.$toast.fail("获取失败，请刷新重试");
    }
  },
};
</script>
<style lang="" scoped></style>
